import java.util.Scanner;
import java.util.Stack;

public class Day_37_1_数据库线程池 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()) {
            Stack<String> stack = new Stack<String>();
            int nums = scan.nextInt();
            while(nums != 0) {
                String c = scan.nextLine();
                String oc = scan.nextLine();
                if(oc.equals("connect")) {
                    stack.push(oc);
                }
                if(oc.equals("disconnect") && !stack.isEmpty()) {
                    stack.pop();
                }
                nums--;
            }
            System.out.println(stack.size());
        }
    }
}
